package com.campus.app.service;

import com.campus.commons.entity.Teacher;
import com.baomidou.mybatisplus.extension.service.IService;
import com.campus.commons.entity.User;
import com.campus.commons.utils.MyPage;
import com.campus.commons.utils.Result;

import java.util.List;

/**
 * <p>
 * 老师表 服务类
 * </p>
 *
 * @author Rin
 * @since 2020-12-24
 */
public interface TeachersService extends IService<Teacher> {
    /**
     * 根据userId 获取教师
     * @param userId 用户Id
     * @return
     */
    Teacher getTeacherByUserId(Integer userId);


    // 多条件查询

    Result<List<Teacher>> getTeachers(Teacher teacher) ;

    /**
     * 多条件查询，分页
     * @param myPage
     * @return
     */
    Result<List<Teacher>> getTeachers(MyPage<Teacher> myPage);

    /**
     * 根据角色Id 查询教师
     * @param roleId
     * @return
     */
    Result<List<Teacher>> getTeachersByRoleId(Integer roleId);

    /**
     * 获取所欲老师的部分信息
     * @author 一行琉璃
     * @return
     * @param page
     * @param limit
     */
    Result<List<Teacher>> getTeacherAll(int page,int limit);

    /**
     * 复合查询
     * @author 一行琉璃
     * @param page
     * @param limit
     * @param teacherName
     * @param phone
     * @param roleName
     * @param idCard
     * @return
     */

    Result<List<Teacher>> getAllBy_xml(int page, int limit, String teacherName, String phone, String roleName, String idCard);

    /**
     * 删除teacher表信息并且删除user表
     *
     * @param id
     * @param userId
     * @return
     */
    Result delUser(int id, int userId);

    /**
     * 修改用户信息
     *
     * @param user
     * @param teacher
     * @return
     * @author 一行琉璃
     */
    Result update(User user, Teacher teacher);

    /**
     * 添加一名教师信息，并且添加user信息
     *
     * @param user
     * @param teacher
     * @return
     * @author 一行琉璃
     */
    Result addTeacher(User user, Teacher teacher);

    /**
     * 验证身份证
     *
     * @param idcard
     * @return
     * @author 一行琉璃
     */
    Boolean checkIdCard(String idcard);
}

